﻿@namespace Masa.Blazor.Presets

<MSnackbar Value="Value"
           ValueChanged="ValueChanged"
           Color="@ComputedColor"
           Class="@_cssProvider?.GetClass()"
           ContentClass="@ContentClass"
           Elevation="@Elevation"
           MultiLine="@MultiLine"
           Outlined="@Outlined"
           Rounded="@Rounded"
           Shaped="@Shaped"
           Style="@_cssProvider?.GetStyle()"
           Text="@Text"
           Tile="@Tile"
           Timeout="@ComputedTimeout"
           Vertical="@Vertical"
           Top="Top"
           Right="Right"
           Bottom="Bottom"
           Left="Left"
           OnClosed="@HandleOnClosed">
    <ChildContent>
        <div Class="@_cssProvider?.GetClass("wrapper")">
            @if (ComputedIcon != null)
            {
                <MIcon Color="@IconColor"
                       Class="@_cssProvider?.GetClass("icon")">
                    @ComputedIcon
                </MIcon>
            }

            <div>
                @if (Title != null)
                {
                    <div class="@_cssProvider?.GetClass("title")">@Title</div>
                }

                @Content
            </div>
        </div>
    </ChildContent>
    <ActionContent>
        @if (OnAction != null)
        {
            <MButton Class="text-capitalize"
                     Color="@(ActionColor ?? IconColor)"
                     Loading="@_actionLoading"
                     Text
                     OnClick="HandleOnAction">
                @ActionText
            </MButton>
        }

        @if (ComputedCloseable)
        {
            <MButton Color="@IconColor"
                     Icon
                     OnClick="HandleOnClose">
                <MIcon>$close</MIcon>
            </MButton>
        }
    </ActionContent>
</MSnackbar>
